#include "io78f0500_30.h"
#include "adc.h"
#include "definition.h"

/* ADC Eingang  1-4 */
void ADCinput(int input)    
{

  if (input == 1)
  {
    ADS = 0x01;
  }
  if (input == 2)
  {
    ADS = 0x02;
  }
  if (input == 3)
  {
    ADS = 0x03;
  }
  if (input == 4)
  {
    ADS = 0x04;
  }

}

float ADCvalue()
{
  while(!ADCflag);
  int erg = ADCR>>6;
  ADCflag=0;
  float ergebniss = (erg*5)/1024.;
  return ergebniss;
}

int Pegel(int mes[])
{
  int Max=0; 
  for (int i=1;i<10;i++) 
    if (mes[i]>mes[Max]) 
      Max=i; 
  return Max;
}